If you have not seen Devel::NYTProf yet then you must be living under a rock. I installed it on one of our development servers at work today (after watching the OSCON presentation. I have not had a chance to use it much but I am already deeply in love!
So I was reading through the docs and thinking "it works with mod_perl but what about normal CGI scripts?" Nothing that I have read indicated that it could not be done so I edited my Apache config to add the following (and restarted Apache of course):
SetEnv PERL5OPT -d:NYTProf SetEnv NYTPROF=file=/tmp/nytprof.out
I then accessed one of our CGI scripts and went to /tmp to create the HTML. However nytprof.out was not there. In its place was nytprof.out=!
So I changed the second line to be (and restarted Apache):
SetEnv NYTPROF=file=/tmp/nytprof.out:Yep, that second line really ends with a colon.
I hit the same CGI script and looked in /tmp. Yep, nytprof.out was there. Yay! (But I get "Unknown option:" in my error log.)
I think that I need to file a bug report (but have not yet because I do not know if it is an Apache bug, a Devel::NYTProf bug or simply user error). What do you think?
My next step was to run nytprofhtml.
[mmusgrove@somebox tmp]$ nytprofhtml Generating report... Unable to open '/long/path/to/cgi-bin/security/Parser.yp' for reading: No such file or directory. Try running /opt/misc/bin/nytprofhtml in the same directory as you ran Devel::NYTProf, or ensure @INC is correct.
I look in /long/path/to/cgi-bin/security and sure enough there is not a Parser.yp file. The good news is that (most of) the HTML files were generated. *drool* They are absolutely gorgeous!
I pull up the index.html file in Firefox and scroll down a bit. What do I see but:
230 0.00431 0.00002 line . block . sub /long/path/to/cgi-bin/security/Parser.ypI click on "line" and everything shown is from Template::Grammar.
28 1 1 0.00033 0.00033 Template::Grammar:: __ANON__[Parser.yp:72]
I do not particularly care that I cannot drop down into the guts of Parser.yp. Yet I still cannot help but wonder if it is a bug in Devel::NYTProf or simply a by-product of how I got the profiling done... Anyone have any ideas?
Re:Something to look into then.
Mr. Muskrat on 2008-08-11T14:17:26
package Devel::NYTProf;
our $VERSION = '2.02';